import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/login_model.dart';

LoginModel $LoginModelFromJson(Map<String, dynamic> json) {
  final LoginModel loginModel = LoginModel();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    loginModel.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    loginModel.msg = msg;
  }
  final LoginModelData? data = jsonConvert.convert<LoginModelData>(
      json['data']);
  if (data != null) {
    loginModel.data = data;
  }
  return loginModel;
}

Map<String, dynamic> $LoginModelToJson(LoginModel entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data?.toJson();
  return data;
}

extension LoginModelExtension on LoginModel {
  LoginModel copyWith({
    int? code,
    String? msg,
    LoginModelData? data,
  }) {
    return LoginModel()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

LoginModelData $LoginModelDataFromJson(Map<String, dynamic> json) {
  final LoginModelData loginModelData = LoginModelData();
  final int? expiredAt = jsonConvert.convert<int>(json['expiredAt']);
  if (expiredAt != null) {
    loginModelData.expiredAt = expiredAt;
  }
  final String? accessToken = jsonConvert.convert<String>(json['accessToken']);
  if (accessToken != null) {
    loginModelData.accessToken = accessToken;
  }
  return loginModelData;
}

Map<String, dynamic> $LoginModelDataToJson(LoginModelData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['expiredAt'] = entity.expiredAt;
  data['accessToken'] = entity.accessToken;
  return data;
}

extension LoginModelDataExtension on LoginModelData {
  LoginModelData copyWith({
    int? expiredAt,
    String? accessToken,
  }) {
    return LoginModelData()
      ..expiredAt = expiredAt ?? this.expiredAt
      ..accessToken = accessToken ?? this.accessToken;
  }
}